requireJS(['constant', 'site', 'handlebars'], function (Constant, site, Handlebars) {
    var url = {
        a: 'manager/queryCarloanService.do',
        b: 'manager/updateCarloanService.do'
    }
    var updateData = {};

    function init() {
        site.send({
            url: url.a,//
            //async:false
            data: {},
            callback: function (data) {
                var list = JSON.parse(data);
                $("#back_name").val(list.content.bg_name);
                $("#lock_cycle").val(list.content.lock_cycle);
                $("#overdue_times").val(list.content.overdue_times);
                $("#bbc_cost").val(list.content.bbc_cost);
                $("#bdebt_numbers").val(list.content.bdebt_numbers);
                $("#bg_id").val(list.content.id)
            }
        })
    }

    init();
    $(".tabHint-alone").click(function () {
        if ($("#back_name") != '') {
            updateData.bg_name = $("#back_name").val();
        }
        if ($("#lock_cycle") != '') {
            updateData.lock_cycle = $("#lock_cycle").val();
        }
        if ($("#overdue_times") != '') {
            updateData.overdue_times = $("#overdue_times").val();
        }
        if ($("#bbc_cost") != '') {
            updateData.bbc_cost = $("#bbc_cost").val();
        }
        if ($("#bdebt_numbers") != '') {
            updateData.bdebt_numbers = $("#bdebt_numbers").val();
        }

        updateData.id = $("#bg_id").val();

        site.send({
            url: url.b,//
            //async:false
            data: updateData,
            callback: function (data) {
                var list = JSON.parse(data);
                if (list.type == '1') {
                    Constant.fn.Message('T', list.msg)
                    init();
                } else {
                    Constant.fn.Message('F', list.msg)
                }
            }
        })

    })


})